package team.se.tms.util;

import java.util.UUID;

/**
 * UUID工具类
 * UUID含义是通用唯一识别码
 *
 * @author winkyle
 * @date 2018/11/8
 */
public class UUIDUtil {

    /**
     * 生成去掉'-'后的32位UUID
     *
     * @return UUID字符串
     * @create on 2018/11/8 by winkyle
     */
    public static String generateUUID() {
        String uuid = UUID.randomUUID().toString().trim().replaceAll("-", "");
        return uuid;
    }

    /**
     * 生成指定数量的UUID
     *
     * @param number 数量
     * @return UUID字符串数组
     * @create on 2018/11/8 by winkyle
     */
    public static String[] generateUUIDs(Integer number) {
        if (number < 1) {
            return null;
        }
        String[] uuids = new String[number];
        for (int i = 0; i < number; i++) {
            uuids[i] = generateUUID();
        }
        return uuids;
    }
}
